//
//  DAlertController.m
//  CJPackOCDemo
//
//  Created by 陈警卫 on 2025/7/15.
//

#import "DAlertController.h"
#import "CJPack-Swift.h"

@interface DAlertController ()

@end

@implementation DAlertController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self setupView];
}

- (void)setupView {
    
    UIButton *btn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [btn setTitle:@"Show" forState:(UIControlStateNormal)];
    [btn setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
    btn.backgroundColor = [UIColor yellowColor];
    btn.frame = CGRectMake(20, 100, 100, 30);
    [self.view addSubview:btn];
    
    __weak __typeof(self) wself = self;
    [btn cj_addActionWithClosure:^(UIButton * _Nonnull btn) {
        
        [wself show];
        
    } for:(UIControlEventTouchUpInside)];
}

- (void)show {
    
    /**
    [CJAlerter showAlertWithTitle:@"title" message:@"message" preferredStyle:UIAlertControllerStyleAlert cancelTitle:@"cancel" destructiveTitle:@"des" otherTitles:@[@"sure"] handler:^(UIAlertAction * _Nonnull alert, NSInteger index) {
        
    } tfPlaceholders:nil tfComple:^(NSArray<NSString *> * _Nonnull value) {
        
    }];
     */
    
    /**
    [CJAlerter showAlertWithTitle:@"title" message:@"message" cancelTitle:@"cancel" destructiveTitle:@"des" otherTitles:@[@"sure"] handler:^(UIAlertAction * _Nonnull alert, NSInteger index) {
        NSLog(@"%ld", index);
    }];
     */
    
    [CJAlerter showSheetWithTitle:@"title" message:@"message" cancelTitle:@"cancel" destructiveTitle:@"des" otherTitles:@[@"sure"] handler:^(UIAlertAction * _Nonnull alert, NSInteger index) {
        NSLog(@"%ld", index);
    }];
    
}


@end
